package nbcb;

import java.util.Scanner;

public class J {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n;
        double ans, max, min, num;
        while (sc.hasNext()) {
            n = sc.nextInt();
            ans = 0.0;
            max = -1;
            min = 101;
            for (int i = 0; i < n; i++) {
                num = sc.nextDouble();
                max = Math.max(max, num);
                min = Math.min(min, num);
                ans += num;
            }
            ans = (ans - (max + min)) / (n - 2);
            System.out.printf("%.2f\n", ans);
        }
    }
}
